package com.fla.shapeevader.model.support;

import android.graphics.RectF;

import com.fla.shapeevader.model.Trajectory;

public class ReflectionalTrajectory extends Trajectory {

    public ReflectionalTrajectory(float direction, float speed) {
        super(direction, speed);
    }

    @Override
    public float getDx() {
        return (float) (getSpeed() * Math.cos(getDirection()));
    }

    @Override
    public float getDy() {
        return (float) (getSpeed() * Math.sin(getDirection()));
    }

    @Override
    public void recalculateParams(RectF bounds, float fullWidth, float fullHeight) {
        if (bounds.right >= fullWidth) {
            updateRightReflection();
        }
        else if (bounds.left <= 0) {
            updateLeftReflection();
        }
        else if (bounds.bottom >= fullHeight) {
            updateBottomReflection();
        }
        else if (bounds.top <= 0) {
            updateTopReflection();
        }
    }

}
